using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace ICP_MS.Plugin.HPLC;

public class FormShowdata : Form
{
	private ExperimentDatas experiment = null;

	private IContainer components = null;

	private GroupBox gbIsotopes;

	private DataGridView dgvIsotopes;

	private GroupBox gbDatas;

	private CheckBox chkRsd;

	private CheckBox chkSd;

	private CheckBox chkMean;

	private CheckBox chkRun;

	private Button btnOK;

	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;

	private DataGridViewCheckBoxColumn colVisible;

	private DataGridViewTextBoxColumn colSymbol;

	public FormShowdata(ExperimentDatas datas)
	{
		experiment = datas;
		InitializeComponent();
	}

	private void FormShowdata_Load(object sender, EventArgs e)
	{
		dgvIsotopes.AutoGenerateColumns = false;
		dgvIsotopes.DataSource = experiment.Isotopes;
		chkRun.Checked = experiment.ReportParams.ShowRuns;
		chkMean.Checked = experiment.ReportParams.ShowMean;
		chkRsd.Checked = experiment.ReportParams.ShowRsd;
		chkSd.Checked = experiment.ReportParams.ShowSd;
		ApplyResources();
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormShowdata.Title.Text");
		chkMean.Text = Lang.Txt("FormShowdata.Average.Text");
		chkRsd.Text = Lang.Txt("FormShowdata.RSD.Text");
		chkRun.Text = Lang.Txt("FormShowdata.SingleResult.Text");
		chkSd.Text = Lang.Txt("FormShowdata.STD.Text");
		gbDatas.Text = Lang.Txt("FormShowdata.Set.Text");
		gbIsotopes.Text = Lang.Txt("FormShowdata.Element.Text");
		colSymbol.HeaderText = Lang.Txt("FormShowdata.Columns.Element.Text");
		colVisible.HeaderText = Lang.Txt("FormShowdata.Columns.Show.Text");
		btnOK.Text = Lang.Txt("FormShowdata.Set.Text");
	}

	private void chkRun_CheckedChanged(object sender, EventArgs e)
	{
		experiment.ReportParams.ShowRuns = chkRun.Checked;
	}

	private void chkSd_CheckedChanged(object sender, EventArgs e)
	{
		experiment.ReportParams.ShowSd = chkSd.Checked;
	}

	private void chkRsd_CheckedChanged(object sender, EventArgs e)
	{
		experiment.ReportParams.ShowRsd = chkRsd.Checked;
	}

	private void btnOK_Click(object sender, EventArgs e)
	{
		base.DialogResult = DialogResult.OK;
	}

	private void chkMean_CheckedChanged(object sender, EventArgs e)
	{
		experiment.ReportParams.ShowMean = chkMean.Checked;
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
		this.gbIsotopes = new System.Windows.Forms.GroupBox();
		this.dgvIsotopes = new System.Windows.Forms.DataGridView();
		this.colVisible = new System.Windows.Forms.DataGridViewCheckBoxColumn();
		this.colSymbol = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.gbDatas = new System.Windows.Forms.GroupBox();
		this.chkRsd = new System.Windows.Forms.CheckBox();
		this.chkSd = new System.Windows.Forms.CheckBox();
		this.chkMean = new System.Windows.Forms.CheckBox();
		this.chkRun = new System.Windows.Forms.CheckBox();
		this.btnOK = new System.Windows.Forms.Button();
		this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.gbIsotopes.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvIsotopes).BeginInit();
		this.gbDatas.SuspendLayout();
		base.SuspendLayout();
		this.gbIsotopes.Controls.Add(this.dgvIsotopes);
		this.gbIsotopes.Location = new System.Drawing.Point(12, 12);
		this.gbIsotopes.Name = "gbIsotopes";
		this.gbIsotopes.Size = new System.Drawing.Size(167, 299);
		this.gbIsotopes.TabIndex = 0;
		this.gbIsotopes.TabStop = false;
		this.gbIsotopes.Text = "元素";
		this.dgvIsotopes.AllowUserToAddRows = false;
		this.dgvIsotopes.AllowUserToDeleteRows = false;
		this.dgvIsotopes.AllowUserToResizeColumns = false;
		this.dgvIsotopes.AllowUserToResizeRows = false;
		dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
		dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
		dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
		dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
		dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
		dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
		this.dgvIsotopes.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
		this.dgvIsotopes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		this.dgvIsotopes.Columns.AddRange(this.colVisible, this.colSymbol);
		this.dgvIsotopes.Dock = System.Windows.Forms.DockStyle.Fill;
		this.dgvIsotopes.Location = new System.Drawing.Point(3, 17);
		this.dgvIsotopes.Name = "dgvIsotopes";
		this.dgvIsotopes.RowHeadersVisible = false;
		this.dgvIsotopes.RowTemplate.Height = 23;
		this.dgvIsotopes.Size = new System.Drawing.Size(161, 279);
		this.dgvIsotopes.TabIndex = 0;
		this.colVisible.DataPropertyName = "visible";
		this.colVisible.HeaderText = "显示";
		this.colVisible.Name = "colVisible";
		this.colVisible.Resizable = System.Windows.Forms.DataGridViewTriState.True;
		this.colVisible.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
		this.colVisible.Width = 60;
		this.colSymbol.DataPropertyName = "symbol";
		this.colSymbol.HeaderText = "元素";
		this.colSymbol.Name = "colSymbol";
		this.colSymbol.ReadOnly = true;
		this.colSymbol.Width = 80;
		this.gbDatas.Controls.Add(this.chkRsd);
		this.gbDatas.Controls.Add(this.chkSd);
		this.gbDatas.Controls.Add(this.chkMean);
		this.gbDatas.Controls.Add(this.chkRun);
		this.gbDatas.Location = new System.Drawing.Point(185, 12);
		this.gbDatas.Name = "gbDatas";
		this.gbDatas.Size = new System.Drawing.Size(179, 231);
		this.gbDatas.TabIndex = 1;
		this.gbDatas.TabStop = false;
		this.gbDatas.Text = "设置";
		this.chkRsd.AutoSize = true;
		this.chkRsd.Location = new System.Drawing.Point(31, 164);
		this.chkRsd.Name = "chkRsd";
		this.chkRsd.Size = new System.Drawing.Size(108, 16);
		this.chkRsd.TabIndex = 3;
		this.chkRsd.Text = "相对偏差(%RSD)";
		this.chkRsd.UseVisualStyleBackColor = true;
		this.chkRsd.CheckedChanged += new System.EventHandler(chkRsd_CheckedChanged);
		this.chkSd.AutoSize = true;
		this.chkSd.Location = new System.Drawing.Point(31, 123);
		this.chkSd.Name = "chkSd";
		this.chkSd.Size = new System.Drawing.Size(96, 16);
		this.chkSd.TabIndex = 2;
		this.chkSd.Text = "标准偏差(σ)";
		this.chkSd.UseVisualStyleBackColor = true;
		this.chkSd.CheckedChanged += new System.EventHandler(chkSd_CheckedChanged);
		this.chkMean.AutoSize = true;
		this.chkMean.Checked = true;
		this.chkMean.CheckState = System.Windows.Forms.CheckState.Checked;
		this.chkMean.Enabled = false;
		this.chkMean.Location = new System.Drawing.Point(31, 89);
		this.chkMean.Name = "chkMean";
		this.chkMean.Size = new System.Drawing.Size(96, 16);
		this.chkMean.TabIndex = 1;
		this.chkMean.Text = "平均结果(χ)";
		this.chkMean.UseVisualStyleBackColor = true;
		this.chkMean.CheckedChanged += new System.EventHandler(chkMean_CheckedChanged);
		this.chkRun.AutoSize = true;
		this.chkRun.Location = new System.Drawing.Point(31, 53);
		this.chkRun.Name = "chkRun";
		this.chkRun.Size = new System.Drawing.Size(96, 16);
		this.chkRun.TabIndex = 0;
		this.chkRun.Text = "单次测量结果";
		this.chkRun.UseVisualStyleBackColor = true;
		this.chkRun.CheckedChanged += new System.EventHandler(chkRun_CheckedChanged);
		this.btnOK.Location = new System.Drawing.Point(225, 270);
		this.btnOK.Name = "btnOK";
		this.btnOK.Size = new System.Drawing.Size(75, 23);
		this.btnOK.TabIndex = 2;
		this.btnOK.Text = "确定";
		this.btnOK.UseVisualStyleBackColor = true;
		this.btnOK.Click += new System.EventHandler(btnOK_Click);
		this.dataGridViewTextBoxColumn1.DataPropertyName = "symbol";
		this.dataGridViewTextBoxColumn1.HeaderText = "元素";
		this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
		this.dataGridViewTextBoxColumn1.Width = 60;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(369, 320);
		base.Controls.Add(this.btnOK);
		base.Controls.Add(this.gbDatas);
		base.Controls.Add(this.gbIsotopes);
		base.Name = "FormShowdata";
		base.ShowIcon = false;
		this.Text = "结果设置";
		base.Load += new System.EventHandler(FormShowdata_Load);
		this.gbIsotopes.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.dgvIsotopes).EndInit();
		this.gbDatas.ResumeLayout(false);
		this.gbDatas.PerformLayout();
		base.ResumeLayout(false);
	}
}
